package com.xdemo.msg;

import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.http.DefaultHttpRequest;

public abstract class BaseHttpMessage extends DefaultHttpRequest implements IMessage<String> {
	
	private ChannelHandlerContext context;
	
	private NettyChunkInputStream chunkedStream;
	
	private int streamLength = 0;
	
	public BaseHttpMessage(HttpBean httpBean) {
		super(httpBean.getVersion(),httpBean.getMethod(),httpBean.getUri());
	}
	
	public ChannelHandlerContext getContext() {
		return context;
	}

	public void setContext(ChannelHandlerContext context) {
		this.context = context;
	}
	
	public NettyChunkInputStream getChunkedStream() {
		return chunkedStream;
	}

	public void setChunkedStream(NettyChunkInputStream chunkedStream) {
		this.chunkedStream = chunkedStream;
	}
	
	public int getStreamLength() {
		return streamLength;
	}

	public void setStreamLength(int streamLength) {
		this.streamLength = streamLength;
	}
	
	@Override
	public String getType() {
		return this.getUri();
	}

	public abstract void readParameters();
	
}
